export function trim(params, matches) {
    let pam = {}
    for (let i in params) {
      if (params[i] !== 0&&params[i]) {
        if (matches) {
          if (!new RegExp(matches, 'g').test(params[i])) {
            pam[i] = params[i]
          }
        } else {
          pam[i] = params[i]
        }
  
      }else{
        if(params[i]===0){
          pam[i] = params[i]
        }
      }
  
    }
    return JSON.stringify(pam) == '{}' ? null : pam
  }
export function getDictName(list,id) {
    if(!list){
        return ""
    }else{
      const obj=list.find(item=>item.id==id)
        return obj?obj.dictLabel:''
    }
}
export function getClassNameByCode(code) {
    let txt = ''
    switch (code) {
        case 'project':
            txt = "项目"
            break;
        case 'bridge':
            txt = "工程"
            break;
        case 'roads':
            txt = "线路"
            break;
            case 'roads':
                txt = "线路"
                break;
        default:
            break;
    }
    return txt
}
